package top.mcwebsite.playandroid.business.settings.impl.vm

import top.mcwebsite.playandroid.common.api.AppService
import top.mcwebsite.playandroid.lib.mvi.base.IIntent
import top.mcwebsite.playandroid.lib.mvi.base.IUiEffect
import top.mcwebsite.playandroid.lib.mvi.base.IUiState
import top.mcwebsite.playandroid.lib.servicemanager.core.ServiceManager

data class SettingsUiState(
    val message: String = "",
    val isShowLogoutDialog: Boolean = false,
    val isDarkMode: Boolean = ServiceManager.getService<AppService>().isDarkMode(),
    val isFollowSystemTheme: Boolean = ServiceManager.getService<AppService>().isFollowSystemTheme(),
): IUiState

sealed interface SettingsIntent : IIntent {

    data object ClickBackIntent : SettingsIntent
    data object ClickLogoutIntent : SettingsIntent
    data object LogoutCancelIntent : SettingsIntent

    data object LogoutConfirmIntent : SettingsIntent

    data object ToggleDarkModeIntent : SettingsIntent

    data object ToggleFollowSystemThemeIntent : SettingsIntent

    data object ClickPrivacyIntent : SettingsIntent

    data object ClickAboutUsIntent : SettingsIntent
}

sealed interface SettingsUiEffect : IUiEffect {
    data object NavigationBackUiEffect : SettingsUiEffect
    data class ShowSnackMessageUiEffect(val snackMsg: String) : SettingsUiEffect

    data object NavigatePrivacyPageUiEffect : SettingsUiEffect
}